package com.ihai.spring.boot.sample.distributed.counter.remote;

import java.io.Serializable;

/**
 * 计数器节点
 *
 * @author 张驰
 * @date 2019/12/23
 */
public class Node implements Serializable {
    private String protocol;
    private String ip;
    private int port;

    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof Node){
            Node tmp = (Node)obj;
            return ((this.ip == null && tmp.ip == null) || (this.ip != null && this.ip.equals(tmp.ip))) && this.port == tmp.port;
        }else{
            return false;
        }
    }
}
